﻿#include "stdafx.h"
#include "XLabelIntParser.h"

#include "XBSTR.h"
#include "XString.h"
#include "StrUtil.h"
#include "Util.h"
#include "IXColorDraw.h"
#include "IXImageDraw.h"
#include "IXLabel.h"

#include "ParseHelper.h"


CXLabelIntParser::CXLabelIntParser() : CXIntParserBase(&TIntCreateControl<IXLabel>)
{
    ;
}

CXLabelIntParser::~CXLabelIntParser()
{
    ;
}

// 填充属性
BOOL CXLabelIntParser::FillAttr(IN IXConfigNode* pNode, IN IXControl* pControl)
{
    BOOL bResult = m_ParentParser.FillAttr(pNode, pControl);
    if(!bResult)
        return bResult;

    XBSTR bstrTemp;
    XString strTemp;
    HRESULT hResult;

    IXLabel* pLabel = Util::QueryIntf<IXLabel>(pControl);
    if(pLabel == NULL)
        return FALSE;

    // RichText
    hResult = pNode->GetValue(_T("richText"), &bstrTemp);
    if(SUCCEEDED(hResult))
    {
        XString strTemp(bstrTemp);
//         if(strTemp.size() > 0 && strTemp.at(0) == _T('@'))
//             strTemp = Util::LoadString(strTemp);
        pLabel->put_RichText(strTemp.GetData());
    }

    return bResult;
}
